package com.huangwei.service.impl;

import com.huangwei.dao.CarDao;
import com.huangwei.model.Car;
import com.huangwei.service.CarService;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;
import java.util.List;

@Service
public class CarServiceImpl implements CarService {
    @Resource
    CarDao carDao;
    @Override
    public Car getOneCarById(int carId) {
        try {
            return carDao.queryOne(carId);
        } catch (Exception e) {
            e.printStackTrace();
        }
        return null;
    }

    @Override
    public List<Car> getCarsBySaleServiceShop(int saleServiceShopId) {
        try {
            return carDao.queryBySaleServiceShop(saleServiceShopId);
        } catch (Exception e) {
            e.printStackTrace();
        }
        return null;
    }

    @Override
    public List<Car> getAllCars() {
        try {
            return carDao.queryAll();
        } catch (Exception e) {
            e.printStackTrace();
        }
        return null;
    }

    @Override
    public List<Car> getCarsByType(Integer typeId) {
        try {
            return carDao.queryByType(typeId);
        } catch (Exception e) {
            e.printStackTrace();
        }
        return null;
    }

    @Override
    public List<Car> getCarsByBand(Integer carBandId) {
        try {
            return carDao.queryByBand(carBandId);
        } catch (Exception e) {
            e.printStackTrace();
        }
        return null;
    }
}
